OBJECT_FILE = lcd1602.rel public.rel main.rel uart.rel buttons.rel

SUDO     = sudo
RM       = rm
COMPILER = sdcc
MAKEBIN  = makebin
PACKIHX  = packihx
STCGAL   = /home/korack/.local/bin/stcgal

BIN_FILE    = vb.bin
LIBS = 
OPTIONS = 
BAUD = 38400
MAKEBIN_ARGS = -s 8192


RUN_COMMANDS = 

all: $(BIN_FILE)

install: $(BIN_FILE)
	$(SUDO) $(STCGAL) $(BIN_FILE) --baud $(BAUD)

$(BIN_FILE) : %.bin : %.hex
	$(MAKEBIN) $(MAKEBIN_ARGS) $< > $@

%.hex : %.ihx
	$(PACKIHX) $< > $@

%.ihx : $(OBJECT_FILE)
	$(COMPILER) -o $@ $^ --model-small

%.rel : %.c
	$(COMPILER) -c $< -I. --model-small

.PHONY : clean
clean:
	$(RM) -f -v *.lst *.sym *.asm *.hex *.lk *.map *.mem *.rst $(OBJECT_FILE) $(BIN_FILE)

